package com.lzy.system.organization.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzy.exception.BusException;
import com.lzy.system.organization.entity.SysRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 角色
 * </p>
 *
 * @author lcc
 * @since 2022-08-13
 */
@Repository
public interface SysRoleMapper extends BaseMapper<SysRole> {
    @Select("SELECT r.id, r.role_name FROM sys_role r, sys_user_role ur WHERE r.id=ur.rid AND ur.uid=#{uid}")
    List<SysRole> selectByUid(@Param("uid") String uid);

    /**
     * 根据映射id查询角色列表
     * @param mid
     * @return
     * @throws Exception
     */
    public List<SysRole> getByMidSysRoleList(Long mid) throws BusException;
}
